﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
///MessageBox 的摘要说明
/// </summary>
public class MessageBox
{
	public MessageBox()
	{
		//
		//TODO: 在此处添加构造函数逻辑
		//
	}
    #region 向客户端输出脚本
    /// <summary>
    /// 向客户端输出脚本
    /// </summary>
    /// <param name="page"></param>
    /// <param name="message"></param>
    public static void Show(System.Web.UI.Page page, string message)
    {
        message = message.Replace("\"", "");
        message = message.Replace("'", "");
        message = message.Replace("\r", "");
        message = message.Replace("\n", "");
        page.ClientScript.RegisterClientScriptBlock(page.GetType(), Guid.NewGuid().ToString(), "alert('" + message + "');", true);

    }
    #endregion

    #region 客户端跳转页面(或者输出相应的js脚本)
    /// <summary>
    /// 向客户端输出脚本
    /// </summary>
    /// <param name="page"></param>
    /// <param name="message"></param>
    public static void script(System.Web.UI.Page page, string message)
    {
       
        page.ClientScript.RegisterClientScriptBlock(page.GetType(), Guid.NewGuid().ToString(),"<script type='text/javascript'>"+message+"</script>",false);

    }
    #endregion
}